#include "faesser.h"
#include "../GlobalVars/vars.h"
#include "FassBlau.h"


void draw_fass_blau()
{
    draw_fass(fassblau);
}

void draw_fass_rot()
{
  draw_fass(fassrot);
}

void draw_faesser(int anz)
{
  if(anz==0)
    {
      glPopMatrix();
      return;
    }
  glPushMatrix();
  glRotatef(-90,0,0,1);
  float z = 5.2f;
  for(int i=0;i<anz;i++)
    {
      glPushMatrix();
      glTranslatef(0,0,z);
      glCallList(dlFassBlau);
      z+=5.2;
      glPopMatrix();
    }
  glPopMatrix();
  glTranslatef(0,4.6,2.6);
  draw_faesser(anz-1);

}

void draw_faesser_pallete(GLuint farbe)
{
  glPushMatrix();
  glScalef(0.3,0.3,0.3);
  glCallList(dlPallete);
  glPopMatrix();
  glPushMatrix();
  glRotatef(-180,0,0,1);
  glTranslatef(-0.8,-2.16,-0.5);
  glScalef(0.25,0.25,0.25);
  glCallList(farbe);
  glTranslatef(7.0,0,0);
  glCallList(farbe);
  glTranslatef(0.0,0.0,7.0);
  glCallList(farbe);
  glTranslatef(-7.0,0.0,0.0);
  glCallList(farbe);
  glPopMatrix();

}

void draw_faesser_pallete_rot()
{
  draw_faesser_pallete(dlFassRot);

}

void draw_faesser_pallete_blau()
{
  draw_faesser_pallete(dlFassBlau);
  
}


void draw_palleten_stapel(float _x, float _y, float _z, int laenge, int breite, int hoehe,GLuint farbe)
{
  glPushMatrix();
  glTranslatef(_x,_y,_z);
  for(int k=0;k<hoehe;k++)
    {
      glPushMatrix();
      for(int i=0;i<laenge;i++)
	{
	  glPushMatrix();
	  for(int j=0;j<breite;j++)
	    {
	      draw_faesser_pallete(farbe);
	      glTranslatef(5,0,0);
	    }
	    glPopMatrix();
	    glTranslatef(0,0,5);
	}
      glPopMatrix();
      glTranslatef(0,2.3,0);
    }
  glPopMatrix();
}

void draw_palleten_berg_blau()
{
  draw_palleten_stapel(50,0.2,50,4,4,4,dlFassBlau);
}

void draw_palleten_berg_rot()
{
  draw_palleten_stapel(40,0.2,15,3,4,3,dlFassRot);
}

void draw_palleten_berg()
{
  // draw_palleten_stapel(60,0.8,6,3,3,3,3);
}

